home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / BSP Tree 1.2 / Sources / Graphics / include / polylist_3d.h < prev    next >
Encoding:
Text File  |  1995-03-26  |  2.9 KB  |  54 lines  |  [TEXT/MMCC]

  1. //------------------------------------------------------------------------------
  2. //    File:                    polylist.h
  3. //    Date:                    9/26/94
  4. //    Author:                Bretton Wade
  5. //
  6. //    Description:    this file contains the class definition for a polygon list
  7. //
  8. //------------------------------------------------------------------------------
  9.  
  10. #include    "polyptr_3d.h"
  11. #include    "bound_3d.h"
  12.  
  13. #ifndef    POLYLIST
  14. #define    POLYLIST
  15.  
  16. //------------------------------------------------------------------------------
  17. //    classes
  18. //------------------------------------------------------------------------------
  19. class    polylist                                                                                                                                    //    polygon list class
  20. {                                                                                                                                                                //    begin class definition
  21.     friend    class    listptr;                                                                                                                //    a list pointer can play with my private parts!
  22.     friend    class    iterator;                                                                                                                //    so can a list iterator
  23.     private:                                                                                                                                            //    members internal to this class only
  24.     protected:                                                                                                                                        //    members internal to this class hierarchy
  25.     struct    node                                                                                                                                    //    node structure definition
  26.     {                                                                                                                                                            //    begin
  27.                 polyptr        ptr;                                                                                                                    //    reference counted polygon pointer
  28.                 node            *next;                                                                                                                //    pointer to the next node
  29.     };                                                                                                                                                        //    end
  30.                 node            *head;                                                                                                                //    the pointer to the head of the list
  31.                 bound_3d    box;                                                                                                                    //    bounding box for the list
  32.                 uchar            ref_count;                                                                                                        //    reference count
  33.                 polylist (void);                                                                                                                //    normal constructor
  34.                 ~polylist (void);                                                                                                                //    destructor
  35.     public:                                                                                                                                                //    members available externally
  36.                 void            AddToList (polyptr &poly);                                                                        //    add a polygon to the list
  37.                 void            Append (listptr &list);                                                                                //    append the contents of list to this list
  38.                 polyptr        Pop (void);                                                                                                        //    pop the head from the list
  39.                 bool            Empty (void) const;                                                                                        //    return whether or not the list is empty
  40.                 void            Draw (void) const;                                                                                        //    draw the polygons in the list
  41. const        bound_3d    &BoundingBox (void) const;                                                                        //    return a reference to the bounding box of the list
  42. };                                                                                                                                                            //    end polygon class definition
  43.  
  44. //------------------------------------------------------------------------------
  45. //    inlines
  46. //------------------------------------------------------------------------------
  47. inline    const        bound_3d    &polylist::BoundingBox (void) const                                        //    return a reference to the bounding box of the list
  48. {                                                                                                                                                                //    begin
  49.     return box;                                                                                                                                        //    return the bounding box
  50. }                                                                                                                                                                //    end
  51.  
  52. //------------------------------------------------------------------------------
  53.  
  54. #endif    //POLYLIST